package meituan2;

import java.util.Arrays;
import java.util.Scanner;

public class Main3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int x = in.nextInt();
        int[] arr = new int[n];
        long[] arr2 = new long[x];
        for(int i=0;i<n;i++){
            arr[i] = in.nextInt();
        }
        for(int i=0;i<x;i++){
            arr2[i] = in.nextLong();
        }

        Arrays.sort(arr);
        long[] dp = new long[n];
        dp[0] = arr[0]*arr[0];
        for(int i=1;i<n;i++){
            dp[i] = dp[i-1]+arr[i]*arr[i];
        }
        //到0,1，...到i的总重量

        for(int i=0;i<x;i++){
            //arr2[i]是包的容量 >= dp[j]
            int j = n-1;
            while (arr2[i]<dp[j]){
                j--;
            }
            j = j+1;

            if(i == 0)System.out.print(j);
            if(i!=0)System.out.print(" "+j);
        }
    }
}
